@extends('layouts.app', ['activePage' => 'admin', 'titlePage' => __('俱乐部管理员管理')])

@section('content')
  <div class="content">
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
          <form method="post" action="{{ route('admins.store') }}" autocomplete="off" class="form-horizontal">
            @csrf
            @method('post')

            <div class="card ">
              <div class="card-header card-header-primary">
                <h4 class="card-title">添加俱乐部管理员</h4>
                <p class="card-category"></p>
              </div>
              <div class="card-body ">
                <div class="row">
                  <div class="col-md-12 text-right">
                      <a href="{{ route('admins.index') }}" class="btn btn-sm btn-primary">返回管理员列表</a>
                  </div>
                </div>
                <div class="row">
                  <label class="col-sm-2 col-form-label">昵称</label>
                  <div class="col-sm-7">
                    <div class="form-group{{ $errors->has('name') ? ' has-danger' : '' }}">
                      <input class="form-control{{ $errors->has('name') ? ' is-invalid' : '' }}" name="name" id="input-name" type="text" placeholder="在此填写管理员账号..." value="{{ old('name') }}" required aria-required="true"/>
                      @if ($errors->has('name'))
                        <span id="name-error" class="error text-danger" for="input-name">至少输入3位字符</span>
                      @endif
                    </div>
                  </div>
                </div>
                <div class="row">
                  <label class="col-sm-2 col-form-label">电话</label>
                  <div class="col-sm-7">
                    <div class="form-group{{ $errors->has('tel') ? ' has-danger' : '' }}">
                      <input class="form-control{{ $errors->has('tel') ? ' is-invalid' : '' }}" name="tel" id="input-tel" type="text" placeholder="在此填写联系方式..." value="{{ old('tel') }}" required />
                      @if ($errors->has('tel'))
                        <span id="tel-error" class="error text-danger" for="input-tel">请填写11位手机号</span>
                      @endif
                    </div>
                  </div>
                </div>
                <div class="row">
                  <label class="col-sm-2 col-form-label" for="input-password">密码</label>
                  <div class="col-sm-7">
                    <div class="form-group{{ $errors->has('password') ? ' has-danger' : '' }}">
                      <input class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" input type="password" name="password" id="input-password" placeholder="在此输入密码..." value="{{ old('password') }}" required />
                      @if ($errors->has('password'))
                        <span id="name-error" class="error text-danger" for="input-name">密码仅限于字母、数字，以及破折号(-)和下划线(_)，且位于6-18位之间</span>
                      @endif
                    </div>
                  </div>
                </div>
                <div class="row">
                  <label class="col-sm-2 col-form-label" for="input-password-confirmation">确认密码</label>
                  <div class="col-sm-7">
                    <div class="form-group">
                      <input class="form-control" onblur="repassword()" name="password_confirmation" id="input-password-confirmation" type="password" placeholder="再次输入密码..." value="{{ old('password_confirmation') }}" required />
                      @if ($errors->has('password'))
                        <span id="name-error" class="error text-danger" for="input-name">两次密码不一致</span>
                      @endif
                    </div>
                  </div>
                </div>
                <div class="row">
                  <label class="col-sm-2 col-form-label" for="input-password-confirmation">所属俱乐部</label>
                  <div class="col-sm-7">
                    <div class="form-group">
                      <select class="form-control selectpicker" data-style="btn btn-link" name="club">
                        @foreach ($club as $club)
                          <option value={{$club->id}}>{{$club->club_name}}</option>
                        @endforeach
                      </select>
                    </div>
                  </div>
                </div>

              </div>
              <div class="card-footer ml-auto mr-auto">
                <button type="submit" class="btn btn-primary">添加</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
@endsection
